<div class="judul"><?php echo anchor("/info_rekap_koin_dropzone/",$title);?></div>
<?php
$uri_segment = $this->uri->segment(3);
if($uri_segment != "" && $uri_segment != "all"){
    $option = parsing_param2($uri_segment);
    $awal = datefmysql($option['awal']);
    $akhir = datefmysql($option['akhir']);
    $dropzone = $option['dropzone'];
    $id_dropzone = $option['idDropzone'];
}else{
    $awal = date("d/m/Y");
    $akhir = date("d/m/Y");
    $dropzone = "";
    $id_dropzone = "";
}
?>
<script type="text/javascript">
      $(function(){
          $('#dropzone').autocomplete("<?php echo site_url('ajax_target')."/getDropzone" ?>",
            {
                parse: function(data){
                    var parsed = [];
                    for (var i=0; i < data.length; i++) {
                        parsed[i] = {
                            data: data[i],
                            value: data[i].batch // nama field yang dicari
                        };
                    }
                    return parsed;
                },
                formatItem: function(data,i,max){
                    return '<div class=result>'+data.nama+'<br>Lokasi: <i>'+data.lokasi+'</i></div>';
                },
                width: 300, // panjang tampilan pencarian autocomplete yang akan muncul di bawah textbox pencarian
                dataType: 'json' // tipe data yang diterima oleh library ini disetup sebagai JSON
            }).result(
            function(event,data,formated){
               $(this).attr('value',data.nama);
               $('#id_dropzone').val(data.id);
            });
            
            $('#submit').click(function(){
                if($('#dropzone').val() == ""){
                    alert('Pilih salah satu dropzone');
                    $('#dropzone').focus();
                    return false;
                }
                if($('#id_dropzone').val() == ""){
                    alert('Pilih salah satu dropzone dengan benar');
                    $('#id_dropzone').focus();
                    return false;
                }
            })
        });
</script>
<div class="data-input">
    <fieldset>
        <legend><?php echo "$formTitle";?></legend>
        <?php
          echo form_open('info_rekap_koin_dropzone/search');
        ?>
        <fieldset class="field-group">
            <legend>Tanggal</legend>
            <?php echo form_input("awal", $awal, "id='awal' class='tanggal datepicker-input'")?>
            <label class="inline-title">s.d</label>
            <?php echo form_input("akhir", $akhir, "id='akhir' class='tanggal datepicker-input'")?>
        </fieldset>
        <label>Dropzone</label><?php echo form_input("dropzone", $dropzone, "id='dropzone'")?>
        <input type="hidden" name="id_dropzone" id="id_dropzone" value="<?php echo "$id_dropzone";?>"/>
        <fieldset class="input-process">
        <?php
          echo form_hidden("Apply",TRUE);
          echo form_hidden("url", $searchLink);
          echo form_submit('add', 'Cari', 'class=button id=submit style=margin-right:2px');
          echo form_button('Batal', 'Batal', 'class=button onClick='."javascript:location.href='".base_url()."index.php/info_rekap_koin_dropzone/'".'');
          echo form_close();
        ?>
        </fieldset>
    </fieldset>
</div>
<fieldset>
<?php
  if($option['Apply'] == TRUE){
?>
<center>
    <h1>Informasi Rekap Koin Dropzone</h1>
    <h2>Periode <?php echo indo_tgl($awal)?> s.d <?php echo indo_tgl($akhir)?></h2>
<?php
  if(file_exists($graph)){
?>
  <img src="<?php echo base_url().$graph;?>" />
<?php
  }
?> 
</center>  
<div class="data-list">
    <table class="tabel" style="width: 100%">
        <tr>
            <th>No</th>
            <th>Tanggal</th>
            <th>Kegiatan</th>
            <th>Lokasi</th>
            <th>Jumlah(Rp.)</th>
        </tr>
        <?php
        $no = 1;
        foreach ($listRekapKoinDropzone['master'] as $row){
        ?>
        <tr class="<?php echo ($no%2)?"even":"odd";?>">
            <td style="text-align:center"><?php echo $no++;?></td>
            <td><?php echo datefmysql($row['tanggal']);?></td>
            <td><?php echo $row['kegiatan'];?></td>
            <td><?php echo $row['lokasi'];?></td>
            <td><?php echo rupiah($row['jumlah']);?></td>
        </tr>
        <?php
        }
        ?>
    </table>
</div>
<?php
  }else{
      echo "<span class='tips'>Silahkan menggunakan opsi pencarian di atas</span>";
  }
?>
</fieldset>